<?php
/**
 * Created by PhpStorm.
 * User: 大伟PHPer
 * Date: 2019/5/10
 * Time: 9:25 PM
 */
$arr = [58,10,60,5,6,8,4,97,2,45];
function sortArr($need){
    static $team = [];
    $minKey = null;
    $need = array_values($need);
    for($i=0;$i<count($need);$i++){
        if($minKey === null || $need[$i] < $need[$minKey]){
            $minKey = $i;
        }
    }
    array_push($team,$need[$minKey]);
    unset($need[$minKey]);
    if(count($need) > 0){
        sortArr($need);
    }
    return $team;

}

print_r($arr);
echo "<br>";
print_r(sortArr($arr));
